new Vue({
    el:"#stander",
    data:{
        feestanders:[],
        placefee:"",
        message:"",
    },
    methods:{
        //检验收费标准是否已存在
        checkPlaceFee:function (e){
            $.ajax({
                // 设置json的属性和值
                url: "/checkPlaceFeeStander",
                contentType: "application/json;charset=UTF-8",
                data: {'placefee':this.placefee},
                async:false,
                type: "get",
                success: function (data) {
                    if(data) {
                        a = "场地类型的收费标准已存在"
                        e.preventDefault()
                    }else {
                        a = ""
                        return true
                    }
                }
            })
            this.message = a;
        },
        //获取所有收费标准
        getFeeStander(){
            var list;
            $.ajax({
                // 设置json的属性和值
                url: "/getFeeStander",
                contentType: "application/json;charset=UTF-8",
                data: null,
                async:false,
                type: "get",
                success: function (data) {
                    list = data.feeStanders
                }
            })
            this.feestanders = list
        },
        deletePlaceFeeStander(feeid,index){
            $.ajax({
                // 设置json的属性和值
                url: "/deletePlaceFeeStander",
                contentType: "application/json;charset=UTF-8",
                data: {'feeid':feeid},
                async:false,
                type: "get",
                success: function (data) {
                }
            })
            this.feestanders.splice(index,1)
        },
        gernerateId: function (index){
            return "update" +index
        },
        gernerateId1: function (index){
            return "#update" +index
        },
    },
    created(){
        this.getFeeStander()
    }
})
